<?php 
	$this->headScript()->appendFile('/js/ajaxConPost.js','text/javascript');
	$this->headScript()->appendFile('/js/yatzy.js','text/javascript'); 
?>


<form id="yatzyGame" method="post" action="">
<?php
	if (isset($this->infoMessage)){
		?>
		<div class="center">
			<div class="info">
				<?php echo($this->infoMessage); ?>
			</div>
		</div>
	<?php }
?>

	<div id="throws">
		<?php echo(Zend_Registry::get('translate')->_('ROLLS_DONE'));?> 
		<p><?php echo($this->diceThrow); ?></p>
	</div>
	
	<div id="diceDiv">
		<div class="dieSplitter1">
			<div class="dieDiv">
				<img id="die1Img" src="http://spagooy.com/pics/dice/<?php echo $this->die1 ?>.gif" alt="<?php echo(Zend_Registry::get('translate')->_('DIE'));?> 1: <?php echo($this->die1); ?>" />
				
				<label class="formLabel" for="saveDie1"><?php echo(Zend_Registry::get('translate')->_('HOLD_DIE'));?></label>
				<input type="checkbox" id="saveDie1" class="dieCheckbox" name="saveDie1"<?php echo($this->saveDice); if ($this->die1checked){ ?> checked="checked" <?php } ?>/>
			</div>
			
			<div class="dieDiv">
				<img id="die2Img" src="http://spagooy.com/pics/dice/<?php echo $this->die2 ?>.gif" alt="<?php echo(Zend_Registry::get('translate')->_('DIE'));?> 2: <?php echo($this->die2); ?>" />
				
				<label class="formLabel" for="saveDie2"><?php echo(Zend_Registry::get('translate')->_('HOLD_DIE'));?></label>
				<?php if (false){ ?>
					<input type="checkbox" id="saveDie2" name="saveDie2"<?php echo($this->saveDice);  if ($this->die2checked){ ?> checked="checked" <?php  } ?>/>
				<?php } else { ?>
					<input type="checkbox" id="saveDie2" class="dieCheckbox" name="saveDie2"<?php echo($this->saveDice); if ($this->die2checked){ ?> checked="checked" <?php } ?>/>
				<?php } ?>	 
			</div>
			
			<div class="dieDiv">
				<img id="die3Img" src="http://spagooy.com/pics/dice/<?php echo $this->die3 ?>.gif" alt="<?php echo(Zend_Registry::get('translate')->_('DIE'));?> 3: <?php echo($this->die3); ?>" />
				
				<label class="formLabel" for="saveDie3"><?php echo(Zend_Registry::get('translate')->_('HOLD_DIE'));?></label>
				<?php if (false){ ?>
					<input type="checkbox" id="saveDie3" name="saveDie3"<?php echo($this->saveDice);  if ($this->die3checked){ ?> checked="checked" <?php  } ?>/>
				<?php } else { ?>
					<input type="checkbox" id="saveDie3" class="dieCheckbox" name="saveDie3"<?php echo($this->saveDice); if ($this->die3checked){ ?> checked="checked" <?php } ?>/>
				<?php } ?>	 

			</div>
		</div>
		
		<div class="dieSplitter2">
			<div class="dieDiv">
				<img id="die4Img" src="http://spagooy.com/pics/dice/<?php echo $this->die4 ?>.gif" alt="<?php echo(Zend_Registry::get('translate')->_('DIE'));?> 4: <?php echo($this->die4); ?>" />
				
				<label class="formLabel" for="saveDie4"><?php echo(Zend_Registry::get('translate')->_('HOLD_DIE'));?></label>
				<input type="checkbox" id="saveDie4" class="dieCheckbox" name="saveDie4"<?php echo($this->saveDice); if ($this->die4checked){ ?> checked="checked" <?php } ?>/>
			</div>
			
			<div class="dieDiv">
				<img id="die5Img" src="http://spagooy.com/pics/dice/<?php echo $this->die5 ?>.gif" alt="<?php echo(Zend_Registry::get('translate')->_('DIE'));?> 5: <?php echo($this->die5); ?>" />
				
				<label class="formLabel" for="saveDie5"><?php echo(Zend_Registry::get('translate')->_('HOLD_DIE'));?></label>
				<input type="checkbox" id="saveDie5" class="dieCheckbox" name="saveDie5"<?php echo($this->saveDice); if ($this->die5checked){ ?> checked="checked" <?php } ?>/>
			</div>
		</div>
	
	
		<?php if ($this->diceThrow == 3) { ?>
				<input type="submit" value="<?php echo(Zend_Registry::get('translate')->_('ROLL'));?>" id="rollDice" name="rollDice" disabled="disabled"/>
			<?php } else { ?>	
				<input type="submit" value="<?php echo(Zend_Registry::get('translate')->_('ROLL'));?>" id="rollDice" name="rollDice"/>
			<?php } ?>
	</div>

	<form id="scoreSheet" method="post" action="">
		<div class="resultDiv">
			<table border="1" id="resTable">
				<thead>
					<tr>
						<th><?php echo(Zend_Registry::get('translate')->_('PLAYER'));?></th>
						<th><?php echo(Zend_Registry::get('translate')->_('PLAYER')).' 1';?></th>
					</tr>
				</thead>
				<tbody>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('ONES'));?></td>
					<td><?php
					 		if($this->onesRes)
							{
								echo($this->ones);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->ones</label><input type=\"radio\" name=\"setPoints\" value=\"Ones\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('TWOS'));?></td>
					<td><?php
					 		if($this->twosRes)
							{
								echo($this->twos);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->twos</label><input type=\"radio\" name=\"setPoints\" value=\"Twos\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('THREES'));?></td>
					<td><?php
					 		if($this->threesRes)
							{
								echo($this->threes);
							}
							else
							{
								if ($this->diceThrow > 0) {						
									echo("<label>$this->threes</label><input type=\"radio\" name=\"setPoints\" value=\"Threes\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('FOURS'));?></td>
					<td><?php
					 		if($this->foursRes)
							{
								echo($this->fours);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->fours</label><input type=\"radio\" name=\"setPoints\" value=\"Fours\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('FIVES'));?></td>
					<td><?php
					 		if($this->fivesRes)
							{
								echo($this->fives);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->fives</label><input type=\"radio\" name=\"setPoints\" value=\"Fives\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('SIXES'));?></td>
					<td><?php
					 		if($this->sixesRes)
							{
								echo($this->sixes);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->sixes</label><input type=\"radio\" name=\"setPoints\" value=\"Sixes\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('TOTAL'));?></td>
					<td><?php echo($this->subSum); ?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('BONUS'));?></td>
					<td><?php echo($this->bonus); ?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('PAIR'));?></td>
					<td><?php
					 		if($this->pairRes)
							{
								echo($this->pair);
							}
							else
							{
								if ($this->diceThrow > 0) {								
									echo("<label>$this->pair</label><input type=\"radio\" name=\"setPoints\" value=\"Pair\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('TWO_PAIR'));?></td>
					<td><?php
					 		if($this->twopairRes)
							{
								echo($this->twopair);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->twopair</label><input type=\"radio\" name=\"setPoints\" value=\"TwoPair\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('THREE_OF_A_KIND'));?></td>
					<td><?php
					 		if($this->threeofakindRes)
							{
								echo($this->threeofakind);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->threeofakind</label><input type=\"radio\" name=\"setPoints\" value=\"ThreeOfAKind\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('FOUR_OF_A_KIND'));?></td>
					<td><?php
					 		if($this->fourofakindRes)
							{
								echo($this->fourofakind);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->fourofakind</label><input type=\"radio\" name=\"setPoints\" value=\"FourOfAKind\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('SMALL_STRAIGHT'));?></td>
					<td><?php
					 		if($this->smallStrightRes)
							{
								echo($this->smallStright);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->smallStright</label><input type=\"radio\" name=\"setPoints\" value=\"SmallStraight\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('LARGE_STRAIGHT'));?></td>
					<td><?php
					 		if($this->bigStrightRes)
							{
								echo($this->bigStright);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->bigStright</label><input type=\"radio\" name=\"setPoints\" value=\"BigStraight\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('FULL_HOUSE'));?></td>
					<td><?php
					 		if($this->fullhouseRes)
							{
								echo($this->fullhouse);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->fullhouse</label><input type=\"radio\" name=\"setPoints\" value=\"FullHouse\"/>");
								}
							}
						?></td>
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('CHANCE'));?></td>
					<td><?php
					 		if($this->chanceRes)
							{
								echo($this->chance);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->chance</label><input type=\"radio\" name=\"setPoints\" value=\"Chance\"/>");
								}
							}
						?></td>			
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('YATZY'));?></td>
					<td><?php
					 		if($this->yatzyRes)
							{
								echo($this->yatzy);
							}
							else
							{
								if ($this->diceThrow > 0) {
									echo("<label>$this->yatzy</label><input type=\"radio\" name=\"setPoints\" value=\"Yatzy\"/>");
								}
							}
						?></td>			
				</tr>
				<tr>
					<td><?php echo(Zend_Registry::get('translate')->_('SCORE'));?></td>
					<td><?php echo($this->sum); ?></td>
				</tr>
				</tbody>
			</table>
			<div id="saveloaderDiv"></div>
			<?php			
				if ($this->diceThrow == 0) { ?>
					<input type="submit" value="<?php echo(Zend_Registry::get('translate')->_('SAVE'));?>" name="save" id="save" disabled="disabled"/>				
				<?php } else { ?>
					<input type="submit" value="<?php echo(Zend_Registry::get('translate')->_('SAVE'));?>" name="save" id="save" />
				<?php }
			?>
		</div>
	</form>
</form>


<?php
	if (isset($this->message) == true)
	{
		?> 
		<div class="success">
		<?php echo($this->message); ?>
		</div>
		<?php
	}
?>